package com.xuetang9.t9.xinhuaxia.controller;

import com.github.pagehelper.PageInfo;
import com.xuetang9.t9.xinhuaxia.beans.Goods;
import com.xuetang9.t9.xinhuaxia.beans.GoodsPicturepath;
import com.xuetang9.t9.xinhuaxia.service.IGoodsPicturepathService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author 李亚奇
 * @version 1.0
 * @desc TODO
 * @date 2020/3/3 14:20
 * @copyright liyq
 * @address 成都西部国际金融中心2栋2201
 **/
@RestController
@RequestMapping("goodspicturepath")
public class GoodsPicturepathController {
    @Autowired
    private IGoodsPicturepathService goodsPicturepathService;
    @PostMapping("save")
    public boolean insertGoods(@RequestBody GoodsPicturepath goodsPicturepath){
        boolean insert = goodsPicturepathService.insert(goodsPicturepath);
        return insert;
    }
    @GetMapping("remove/{id}")
    public boolean removeGoods(@PathVariable(value = "id",required = false) Long id){
        boolean remove = goodsPicturepathService.remove(id);
        return remove;
    }
    @PostMapping("update")
    public boolean updateGoods(@RequestBody GoodsPicturepath goodsPicturepath){
        boolean update = goodsPicturepathService.update(goodsPicturepath);
        return update;
    }

    @GetMapping("list/{page}/{perPagesize}")
    public PageInfo<GoodsPicturepath> queryByPage(@PathVariable(value = "page",required = false) Integer page, @PathVariable(value = "perPagesize",required = false) Integer perPagesize){
        PageInfo<GoodsPicturepath> pageInfo = goodsPicturepathService.queryByPage(page, perPagesize);
        return pageInfo;
    }

}
